package cn.shujuhai.meeting.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

/**
 * @Author: NiuYaHu
 * @Date: 2025/7/30 11:53
 * @Description:
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ReservationExportDTO {
    @ExcelProperty("会议主题")
    private String purpose;

    @ExcelProperty("开始日期")
    private LocalDate reservationData;

    @ExcelProperty("开始时间")
    private String startTime; // 使用字符串类型存储时间

    @ExcelProperty("结束时间")
    private String endTime; // 使用字符串类型存储时间

    @ExcelProperty("频次")
    private Long repeatType;

    @ExcelProperty("结束日期")
    private LocalDate repeatEndData;

    @ExcelProperty("会议室")
    private String roomName;

    @ExcelProperty("预约人")
    private String username;

    @ExcelProperty("预约人电话")
    private String phone;

    public ReservationExportDTO(Reservation reservation) {
        this.purpose = reservation.getPurpose();
        this.reservationData = reservation.getReservationData();
        this.startTime = reservation.getStartTime().toString(); // 转换为字符串
        this.endTime = reservation.getEndTime().toString(); // 转换为字符串
        this.repeatType = reservation.getRepeatType();
        this.repeatEndData = reservation.getRepeatEndData();
        this.roomName = reservation.getRoomName();
        this.username = reservation.getUsername();
        this.phone = reservation.getPhone();
    }
}
